package com.test.io.streamrReader;

import org.junit.Test;

import java.io.*;

/**
 * @version 1.0
 * @Author: 许啸林 输出字节转换流 可将字节流转换为字符流输出
 * @Date: 2021/6/4 11:21
 */
public class OutPutStreamWriterDemo {
    @Test
    public void write() {
        BufferedWriter bufferedWriter = null;
        try {

            FileOutputStream  fos = new FileOutputStream("d:\\newFile3.txt");
            bufferedWriter = new BufferedWriter(new OutputStreamWriter(fos,"utf-8"));
            bufferedWriter.write("一点浩然气,千里快哉风。");
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(bufferedWriter != null) {
                try {
                    bufferedWriter.close();
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                }
            }
        }
    }

}
